namespace CSharpPro._0928;

public class Demo
{
    public void TestPrint()
    {
        int num = 10;
        for (int i = 0; i <=10; i++)
        {
            if(i % 2 != 0)
            {
                Console.WriteLine(i + " ");
            }
            
        }
        /*do
        {
            Console.WriteLine(num);
            num--;
        }while(num > 5);
        while (num > 5)
        {
            Console.Write(num+"\t");
            num--;
        }

        while (true)
        {
            int num2 = 20;
            //跳出循环 beark
            if(num2 > 10)
            {
                break;
            }
        }*/
    }
    public void TestPrint2()
    {
        Console.WriteLine("1000以内的水仙花数：");
        for (int num = 100; num < 1000; num++)
        {
            int a = num / 100;      // 百位
            int b = num / 10 % 10;  // 十位
            int c = num % 10;       // 个位

            if (a * a * a + b * b * b + c * c * c == num)
                Console.WriteLine(num);
        }
    }

    public void TestPrint3()
    {
        Console.WriteLine("100以内的质数：");
        for (int n = 2; n <= 100; n++)
        {
            bool isPrime = true;
            for (int i = 2; i < n; i++)  
                
                
                
            {
                if (n % i == 0)
                {
                    isPrime = false;
                    break;
                }
            }
            if (isPrime)
                Console.Write($"{n} ");
        }
        Console.WriteLine();
    }
}